<style scoped>
    .layout {
        border: 1px solid #d7dde4;
        background: #f5f7f9;
    }

    .layout-logo {
        width: 100px;
        height: 30px;
        background: #5b6270;
        border-radius: 3px;
        float: left;
        position: relative;
        top: 15px;
        left: 20px;
    }

    .layout-tools {
        width: 100px;
        height: 30px;
        float: right;
        position: relative;
    }

    .layout-nav {
        width: 620px;
        margin: 0 auto;
    }

</style>

<template>
    <div class="layout">
        <Affix>
            <Menu mode="horizontal" :theme="mainTheme" active-name="1" @on-select="handleMenuSelect">
                <div class="layout-logo"></div>
                <div class="layout-nav">
                    <Menu-item name="1">
                        <Icon type="ios-paper"></Icon>
                        内容管理
                    </Menu-item>
                    <Menu-item name="2">
                        <Icon type="ios-people"></Icon>
                        用户管理
                    </Menu-item>
                    <Submenu name="3">
                        <template slot="title">
                            <Icon type="stats-bars"></Icon>
                            统计分析
                        </template>
                        <Menu-group title="使用">
                            <Menu-item name="3-1">新增和启动</Menu-item>
                            <Menu-item name="3-2">活跃分析</Menu-item>
                            <Menu-item name="3-3">时段分析</Menu-item>
                        </Menu-group>
                        <Menu-group title="留存">
                            <Menu-item name="3-4">用户留存</Menu-item>
                            <Menu-item name="3-5">流失用户</Menu-item>
                        </Menu-group>
                    </Submenu>
                    <Menu-item name="4">
                        <Icon type="settings"></Icon>
                        综合设置
                    </Menu-item>
                </div>
                <div class="layout-tools">
                </div>
            </Menu>
        </Affix>
        <br/>
        <div class="layout-content">
            <router-view></router-view>
        </div>
        <!--<div class="layout-copy">-->
        <!--2016-2017 &copy; Iotstat-->
        <!--</div>-->
    </div>
</template>
<script>
    export default {
        data() {
            return {
                mainTheme: 'light',
                themeSwitch: true
            };
        },
        mounted() {

        },
        beforeDestroy() {

        },
        methods: {
            change (status) {
                if (status) {
                    this.$Message.info('切换到dark主题');
                    this.data.mainTheme = 'dark';
                } else {
                    this.$Message.info('切换到light主题');
                    this.data.mainTheme = 'light';
                }
            },
            handleMenuSelect(name){
                if (name === '1') {
                    this.$router.push({path: '/'});
                } else if (name === '2') {
                    this.$router.push({path: '/form'});
                }
            }
        }
    };
</script>